import { importDeptAccountsApi } from "@/api/configCenter/accountKeeper";
import { reactive, ref } from "vue";

export default function InitHook() {
  const searchForm = reactive<AccountKeeper.SearchForm>({
    shortNameList: "",
    name: "",
    receiveAccount: "",
    openBankList: [],
    deptIdList: [],
    accountPropertiesList: [],
    currencyList: [],
    paymentMethodList: [],
    pageNum: 1,
    pageSize: 100,
    total: 0
  });
  const tableData = ref<Array<AccountKeeper.ListRows>>([]);
  const tableRef = ref<any>(null);
  const dialogOpts = reactive<Base.DialogOpts>({
    title: "",
    width: "520px",
    component: "",
    visible: false,
    type: 1,
    passData: {}
  });
  const drawerOpts = reactive<Base.DrawerOpts>({
    title: "",
    width: "520px",
    component: "",
    visible: false,
    type: 1,
    passData: {}
  });

  //上传文件对应的接口
  const getUpdateOptions: Map<string, any> = new Map([["AccountKeeper", importDeptAccountsApi]]);

  //选择上传文件的类型
  const upLoadType = ref<string>("");

  //上传文件的模版
  const upLoadTemplate = ref<number>(1);

  return {
    searchForm,
    tableData,
    dialogOpts,
    drawerOpts,
    tableRef,
    upLoadType,
    getUpdateOptions,
    upLoadTemplate
  };
}
